This is the scene code for the scene titled “Animation Room.” The first section is the entire scene code, exactly as it is in the game. After that the code is broken down into sections, with an explanation of each section.
PRINT{You can't remove it, it's permanantly attached to the pedestal.}
EXIT
IF{TEXT$=EYE}THEN
PRINT{It won't budge.}
EXIT
IF{TEXT$=HEAD}THEN
IF{HEAD.1=SCENE@}AND{AR.PANEL.1>SCENE@}THEN
MOVE{HEAD.1}TO{STORAGE@}
MOVE{HEAD}TO{PLAYER@}
PRINT{You now have the robot head. The head is lifeless, since it is not attached to a body.}
EXIT
END
END
IF{CLICK$=PED.BUTTON.LEFT}THEN
MOVE{PED.BUTTON.LEFT}TO{STORAGE@}
SOUND{BUTTON-SND.1}
MOVE{PED.BUTTON.LEFT}TO{SCENE@}
SOUND{RADIO-SND.1}
MOVE{SPARK.1}TO{SCENE@}
MOVE{SPARK.2}TO{SCENE@}
MOVE{SPARK.1}TO{STORAGE@}
MOVE{SPARK.3}TO{SCENE@}
MOVE{SPARK.2}TO{STORAGE@}
MOVE{SPARK.3}TO{STORAGE@}
MOVE{SPARK.1}TO{SCENE@}
MOVE{SPARK.2}TO{SCENE@}
MOVE{SPARK.1}TO{STORAGE@}
MOVE{SPARK.3}TO{SCENE@}
MOVE{SPARK.2}TO{STORAGE@}
MOVE{SPARK.3}TO{STORAGE@}
MOVE{SPARK.1}TO{SCENE@}
MOVE{SPARK.2}TO{SCENE@}
MOVE{SPARK.1}TO{STORAGE@}
MOVE{SPARK.3}TO{SCENE@}
MOVE{SPARK.2}TO{STORAGE@}
MOVE{SPARK.3}TO{STORAGE@}
PRINT{This is the simplest form of animation. An object is moved to the scene, then the next object is moved to the scene and the first one is returned to STORAGE.}
PRINT{In this case, there are three objects representing the spark. Each time one is moved to the scene, the previous one is removed.}
PRINT{The button on the pedestal is animated the same way, except only one object is used. When you click on it, it's briefly removed to STORAGE, then returned to the scene.}
PRINT{Here the process is repeated a few times, to increase the running time of the animation.}
EXIT
IF{CLICK$=PED.BUTTON.RIGHT}THEN
MOVE{PED.BUTTON.RIGHT}TO{STORAGE@}
SOUND{BUTTON-SND.1}
MOVE{PED.BUTTON.RIGHT}TO{SCENE@}
SOUND{BOING}
MOVE{EYE.1}TO{STORAGE@}
MOVE{EYE.2}TO{STORAGE@}
MOVE{EYE.3}TO{STORAGE@}
MOVE{EYE.4}TO{STORAGE@}
MOVE{EYE.5}TO{STORAGE@}
MOVE{EYE.6}TO{STORAGE@}
MOVE{EYE.7}TO{STORAGE@}
MOVE{EYE.7}TO{SCENE@}
MOVE{EYE.6}TO{SCENE@}
MOVE{EYE.5}TO{SCENE@}
MOVE{EYE.4}TO{SCENE@}
MOVE{EYE.3}TO{SCENE@}
MOVE{EYE.2}TO{SCENE@}
MOVE{EYE.1}TO{SCENE@}
PRINT{This is a smoother method of animation. All the objects are in the scene, layered one on top of the other. Part of the background is incorporated into each object, to help hide the objects beneath it.}
PRINT{When the button is pushed, the objects are moved to STORAGE one at a time, starting with the top layer.}
PRINT{When only the bottom layer is left, the animation objects are returned to the scene one by one. This returns the Spring-eye to its original position on the pedestal.}
EXIT
IF{CLICK$=WHEEL.1}THEN
PRINT{.....................................}
IF{AR.PANEL.1=SCENE@}THEN
MOVE{WHEEL.1}TO{STORAGE@}
SOUND{SQUEEK.1}
MOVE{WHEEL.1}TO{SCENE@}
MOVE{AR.PANEL.1}TO{STORAGE@}
MOVE{WHEEL.1}TO{STORAGE@}
SOUND{SQUEEK.1}
MOVE{WHEEL.1}TO{SCENE@}
MOVE{AR.PANEL.2}TO{STORAGE@}
MOVE{WHEEL.1}TO{STORAGE@}
SOUND{SQUEEK.1}
MOVE{WHEEL.1}TO{SCENE@}
MOVE{AR.PANEL.3}TO{STORAGE@}
PRINT{Both forms of animation are combined here. The wheel is just one object, over a background drawing, that is removed and replaced repeatedly.}
PRINT{The panel consists of three objects layered on top of each other in the scene, that are removed one by one.}
EXIT
MOVE{WHEEL.1}TO{STORAGE@}
SOUND{SQUEEK.1}
MOVE{WHEEL.1}TO{SCENE@}
MOVE{AR.PANEL.3}TO{SCENE@}
MOVE{WHEEL.1}TO{STORAGE@}
SOUND{SQUEEK.1}
MOVE{WHEEL.1}TO{SCENE@}
MOVE{AR.PANEL.2}TO{SCENE@}
MOVE{WHEEL.1}TO{STORAGE@}
SOUND{SQUEEK.1}
MOVE{WHEEL.1}TO{SCENE@}
MOVE{AR.PANEL.1}TO{SCENE@}
PRINT{Closing the panel is just a matter of returning the objects to the scene.}
EXIT
************End of code***********************************
The main purpose of this scene was to illustrate the basic methods of creating animation effects in World Builder, so most of the code involves animation. You must realize, however, that World Builder is not capable of “arcade game” animation. The kind of animation I’m talking about here is very simple. A series of drawings, each one a different Object, is placed in the scene or removed from the scene, one by one, creating an animation effect similar to a flipbook.
The first statement in the scene code prints a line of periods when the objects in the scene are clicked:
The next section handles the verbs “get” and “take:”
IF{TEXT$=GET}OR{TEXT$=TAKE}THEN
PRINT{.....................................}
IF{TEXT$=ELECTRODE}THEN
PRINT{You can't remove it, it's permanantly attached to the pedestal.}
EXIT
IF{TEXT$=EYE}THEN
PRINT{It won't budge.}
EXIT
IF{TEXT$=HEAD}THEN
IF{HEAD.1=SCENE@}AND{AR.PANEL.1>SCENE@}THEN
MOVE{HEAD.1}TO{STORAGE@}
MOVE{HEAD}TO{PLAYER@}
PRINT{You now have the robot head. The head is lifeless, since it is not attached to a body.}
EXIT
END
END
>>>The first statement in the above section determines whether the words “get” or “take” have been entered. If so, then nested statements check for specific items the player wants to take. If the player has entered “electrode,” then the first nested statement is true, and text is printed telling the player why he can’t take the electrode. If the player has entered the word “eye” then the second nested statement is true, and the player is told that he can’t move the eye.
There is a secret panel in the room that can be opened by turning or clicking a wheel on the wall. Inisde the hidden compartment is a robotic head. So if the player enters “get” or “take” followed by the word “head,” the third nested statement is true. Another statement is nested within that one, which determines whether or not the panel is open and the head is in the compartment. AR.PANEL.1 is the object that shows the compartment closed. HEAD.1 is the immobile object that depicts the head sitting in the compartment. If HEAD.1 is in the scene, AND AR.PANEL.1 is NOT in the scene, then HEAD.1 is moved to storage and the actual “head” object moved to the player. Then some text is displayed telling the player that he has the head, and describing it. The statement closes with EXIT, and the program stops until the next time the player does something.
However, if the object HEAD.1 is not in the scene, OR the compartment is closed, then the innermost statement is ignored. The “get head” statement simply closes with END. In this way, if the player has already retrieved the head from the compartment and is merely trying to pick it up after dropping it in the scene, the program will handle it automatically.
If the player has entered “get” or “take” and has not entered “electrode” or “eye” or “head,” then all the nested statements are ignored, and the first statement closes with END, allowing the program to continue, handling conventional “get” actions to be handled automatically.<<<
The next section of code handles the first example of animation. When the player clicks on the button at the base of the left pedestal, a bolt of electricity passes between the two electrodes in the scene.
IF{CLICK$=PED.BUTTON.LEFT}THEN
MOVE{PED.BUTTON.LEFT}TO{STORAGE@}
SOUND{BUTTON-SND.1}
MOVE{PED.BUTTON.LEFT}TO{SCENE@}
SOUND{RADIO-SND.1}
MOVE{SPARK.1}TO{SCENE@}
MOVE{SPARK.2}TO{SCENE@}
MOVE{SPARK.1}TO{STORAGE@}
MOVE{SPARK.3}TO{SCENE@}
MOVE{SPARK.2}TO{STORAGE@}
MOVE{SPARK.3}TO{STORAGE@}
MOVE{SPARK.1}TO{SCENE@}
MOVE{SPARK.2}TO{SCENE@}
MOVE{SPARK.1}TO{STORAGE@}
MOVE{SPARK.3}TO{SCENE@}
MOVE{SPARK.2}TO{STORAGE@}
MOVE{SPARK.3}TO{STORAGE@}
MOVE{SPARK.1}TO{SCENE@}
MOVE{SPARK.2}TO{SCENE@}
MOVE{SPARK.1}TO{STORAGE@}
MOVE{SPARK.3}TO{SCENE@}
MOVE{SPARK.2}TO{STORAGE@}
MOVE{SPARK.3}TO{STORAGE@}
PRINT{This is the simplest form of animation. An object is moved to the scene, then the next object is moved to the scene and the first one is returned to STORAGE.}
PRINT{In this case, there are three objects representing the spark. Each time one is moved to the scene, the previous one is removed.}
PRINT{The button on the pedestal is animated the same way, except only one object is used. When you click on it, it's briefly removed to STORAGE, then returned to the scene.}
PRINT{Here the process is repeated a few times, to increase the running time of the animation.}
EXIT
>>>In the statement above, PED.BUTTON.LEFT is the name of the object that represents the button on the left pedestal. To create the illusion that the button has actually been depressed when the player clicks on it, the button object is moved to storage, a clicking sound is played, and the button is returned to the scene. The difference in the drawing of the button object, and the drawing of the depressed button that is part of the scene, makes it look as though the button has been depressed and popped back up.
Then the program continues to create the animation of the spark. There are three objects representing the spark. Each is a drawing of the spark, and each is different from the others. The objects are originally kept in storage until the button is clicked. Then the first one is moved to the scene. The second one is moved to the scene next, and the first one is returned to storage. Then SPARK.3 is moved to the scene, and SPARK.2 is returned to storage. Then SPARK.3 is returned to storage. This creates the illusion of a flickering bolt of energy.
However, doing this just once makes the animation go by pretty quickly. So the same steps have been repeated several times to increase the length of the animation. Finally some text is printed which briefly explains the process to the player.<<<
The next section (below) controls what happens when the player clicks on the button at the base of the pedestal on the right. An eyeball on a spring will be made to jump up, then settle back down on the pedestal. The way this effect is achieved is somewhat different from the first animation. All the drawings (objects) are already in the scene at the start, layered on top of each other. Each drawing includes a part that matches the background art in the scene, so that all the drawings layered below will be hidden by the drawings at the top of the layers. When the layers are removed from the scene, one object at a time, it creates an illusion of movement:
IF{CLICK$=PED.BUTTON.RIGHT}THEN
MOVE{PED.BUTTON.RIGHT}TO{STORAGE@}
SOUND{BUTTON-SND.1}
MOVE{PED.BUTTON.RIGHT}TO{SCENE@}
SOUND{BOING}
MOVE{EYE.1}TO{STORAGE@}
MOVE{EYE.2}TO{STORAGE@}
MOVE{EYE.3}TO{STORAGE@}
MOVE{EYE.4}TO{STORAGE@}
MOVE{EYE.5}TO{STORAGE@}
MOVE{EYE.6}TO{STORAGE@}
MOVE{EYE.7}TO{STORAGE@}
MOVE{EYE.7}TO{SCENE@}
MOVE{EYE.6}TO{SCENE@}
MOVE{EYE.5}TO{SCENE@}
MOVE{EYE.4}TO{SCENE@}
MOVE{EYE.3}TO{SCENE@}
MOVE{EYE.2}TO{SCENE@}
MOVE{EYE.1}TO{SCENE@}
PRINT{This is a smoother method of animation. All the objects are in the scene, layered one on top of the other. Part of the background is incorporated into each object, to help hide the objects beneath it.}
PRINT{When the button is pushed, the objects are moved to STORAGE one at a time, starting with the top layer.}
PRINT{When only the bottom layer is left, the animation objects are returned to the scene one by one. This returns the Spring-eye to its original position on the pedestal.}
EXIT
>>>As before, the animation begins with the simulated motion of the button. When the player clicks the button object, it is moved to storage, a sound is played, and then the object is returned to the scene. Then the rest of the animation is performed. The drawings (objects) of the eye are moved to storage one by one, starting with the top layer. When the last object is reached, it is not moved. Instead, the objects are returned to the scene in reverse order, to simulate the effect of the eye falling back onto the pedestal. Then the text is displayed in the text window, telling the player what has occurred.<<<
In the center of the scene, above the doorway, there is a wheel mounted on the wall. When the player clicks the wheel, the the wheel appears to turn, and a secret panel in the wall appears to open. This is sort of a combination of animation effects. The wheel is a single object, positioned exactly over a similar, but rotated, drawing in the scene art. As the object is moved to storage, then returned to the scene, it creates the illusion that the wheel is turning. At the same time, the drawings (objects) of the panel are moved one by one to storage, until the last one is gone:
IF{CLICK$=WHEEL.1}THEN
PRINT{.....................................}
IF{AR.PANEL.1=SCENE@}THEN
MOVE{WHEEL.1}TO{STORAGE@}
SOUND{SQUEEK.1}
MOVE{WHEEL.1}TO{SCENE@}
MOVE{AR.PANEL.1}TO{STORAGE@}
MOVE{WHEEL.1}TO{STORAGE@}
SOUND{SQUEEK.1}
MOVE{WHEEL.1}TO{SCENE@}
MOVE{AR.PANEL.2}TO{STORAGE@}
MOVE{WHEEL.1}TO{STORAGE@}
SOUND{SQUEEK.1}
MOVE{WHEEL.1}TO{SCENE@}
MOVE{AR.PANEL.3}TO{STORAGE@}
PRINT{Both forms of animation are combined here. The wheel is just one object, over a background drawing, that is removed and replaced repeatedly.}
PRINT{The panel consists of three objects layered on top of each other in the scene, that are removed one by one.}
EXIT
MOVE{WHEEL.1}TO{STORAGE@}
SOUND{SQUEEK.1}
MOVE{WHEEL.1}TO{SCENE@}
MOVE{AR.PANEL.3}TO{SCENE@}
MOVE{WHEEL.1}TO{STORAGE@}
SOUND{SQUEEK.1}
MOVE{WHEEL.1}TO{SCENE@}
MOVE{AR.PANEL.2}TO{SCENE@}
MOVE{WHEEL.1}TO{STORAGE@}
SOUND{SQUEEK.1}
MOVE{WHEEL.1}TO{SCENE@}
MOVE{AR.PANEL.1}TO{SCENE@}
PRINT{Closing the panel is just a matter of returning the objects to the scene.}
EXIT
>>>The first IF/THEN statement determines if the wheel object has been clicked on. If it has, then a nested statement checks to see if the panel is closed. If so, then the wheel object is moved to storage, a squeeking sound is played, and the first panel object is moved to storage. Then the wheel object is returned to the scene, and the process is repeated. Each time the wheel is moved, another panel object is also moved to storage until the last one is gone. Then the text is printed, and the program stops.
If the panel is already open, then the process is reversed. The wheel “turns” as the panel objects are returned to the scene one by one.<<<
In this simple game, if the player tries to turn the wheel by entering “turn wheel,” then the player is told to click on it: